home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / Libraries / LinAlg 3.1 / ANSI #includes addenda / istream next >
Encoding:
Text File  |  1995-05-30  |  3.3 KB  |  126 lines  |  [TEXT/TBB6]

  1. // istream standard header
  2. #ifndef _ISTREAM_
  3. #define _ISTREAM_
  4. #include <streambuf>
  5.  
  6. #if __MWERKS__
  7. #pragma options align=mac68k
  8. #endif
  9.  
  10.         // class istream
  11. class istream : virtual public ios {
  12. public:
  13.     istream(streambuf *_S)
  14.         : _Chcount(0) { init(_S); }
  15.     istream(_Uninitialized)
  16.         : ios(_Noinit) {}
  17.     virtual ~istream();
  18.     _Bool ipfx(int = 0);
  19.     void isfx()
  20.         {}
  21.     istream& operator>>(istream& (*_F)(istream&))
  22.         {return ((*_F)(*this)); }
  23.     istream& operator>>(ios& (*_F)(ios&))
  24.         {(*_F)(*(ios *)this); return (*this); }
  25.     istream& operator>>(char *);
  26.     istream& operator>>(unsigned char *_S)
  27.         {return (*this >> (char *)_S); }
  28.     istream& operator>>(char&);
  29.     istream& operator>>(unsigned char& _C)
  30.         {return (*this >> *(char *)&_C); }
  31.     istream& operator>>(short&);
  32.     istream& operator>>(unsigned short&);
  33.     istream& operator>>(int&);
  34.     istream& operator>>(unsigned int&);
  35.     istream& operator>>(long&);
  36.     istream& operator>>(unsigned long&);
  37.     istream& operator>>(float&);
  38.     istream& operator>>(double&);
  39.     istream& operator>>(long double&);
  40.     istream& operator>>(void *&);
  41.     istream& operator>>(streambuf&);
  42.     int get();
  43.     istream& get(char *, int, char = '\n');
  44.     istream& get(unsigned char *_S, int _N, char _D = '\n')
  45.         {return(get((char *)_S, _N, _D)); }
  46.     istream& get(char&);
  47.     istream& get(unsigned char& _C)
  48.         {return (get((char&)_C)); }
  49.     istream& get(streambuf&, char = '\n');
  50.     istream& getline(char *, int, char = '\n');
  51.     istream& getline(unsigned char *_S, int _N, char _D = '\n')
  52.         {return(getline((char *)_S, _N, _D)); }
  53.     istream& ignore(int = 1, int = EOF);
  54.     istream& read(char *, int);
  55.     istream& read(unsigned char *_S, int _N)
  56.         {return(read((char *)_S, _N)); }
  57.     int peek();
  58.     istream& putback(char);
  59.     istream& unget();
  60.     int gcount() const
  61.         {return (_Chcount); }
  62.     int sync();
  63.  streampos tellg(void)
  64.   { streampos pos = rdbuf()->pubseekoff(0, ios::cur, ios::in);
  65.     if( pos == streampos(EOF) )
  66.       setstate(ios::badbit);
  67.     return pos;
  68.   }
  69. istream& seekg(streamoff off, ios::seekdir dir)
  70. {
  71.   streampos pos = rdbuf()->pubseekoff(off,dir,ios::in);
  72.   if (pos == streampos(EOF))
  73.     setstate(ios::badbit);
  74.   return *this;
  75. }
  76. istream& seekg(streampos pos)
  77. {
  78.     pos = rdbuf()->pubseekpos(pos, ios::in);
  79.     if (pos == streampos(EOF))
  80.         setstate(ios::badbit);
  81.     return *this;
  82. }
  83. #if _HAS_SIGNED_CHAR
  84.     istream& operator>>(signed char *_S)
  85.         {return (*this >> (char *)_S); }
  86.     istream& operator>>(signed char& _C)
  87.         {return (*this >> *(char *)&_C); }
  88.     istream& get(signed char *_S, int _N, char _D = '\n')
  89.         {return (get((char *)_S, _N, _D)); }
  90.     istream& get(signed char& _C)
  91.         {return (get((char&)_C)); }
  92.     istream& getline(signed char *_S, int _N, char _D = '\n')
  93.         {return (getline((char *)_S, _N, _D)); }
  94.     istream& read(signed char *_S, int _N)
  95.         {return (read((char *)_S, _N)); }
  96. #endif /* _HAS_SIGNED_CHAR */
  97. protected:
  98.     int _Getffld(char [_MAX_EXP_DIG + _MAX_SIG_DIG + 16]);
  99.     int _Getifld(char [_MAX_INT_DIG], _Bool = 0);
  100. private:
  101.     int _Chcount;
  102.     };
  103.         // manipulators
  104. istream& ws(istream&);
  105.  
  106. #if __MWERKS__
  107. #pragma options align=reset
  108. #endif
  109.  
  110. #endif
  111.  
  112. /*
  113.  * Copyright (c) 1994 by P.J. Plauger.  ALL RIGHTS RESERVED. 
  114.  * Consult your license regarding permissions and restrictions.
  115.  */
  116.  
  117. /* Change log:
  118.  * 1994-06-04: PlumHall baseline
  119.  * 1994-09-30: Applied diffs for Fri Aug 26 00:51:20 1994
  120.  * 1994-10-07: Inserted MW changes.
  121.  * 1994-10-14: XL04 change istream(streambuf *_S) to init derived 
  122.  */
  123.  
  124. /* Change log:
  125.  */
  126.